<template>
    <div>
        <h1>房号添加</h1>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <th align="right">房号名称</th>
                    <th><input type="text" v-model="queryinfo.NName"></th>
                </tr>
                <tr>
                    <th align="right">房号编号</th>
                    <th><input type="text" v-model="queryinfo.NCode"></th>
                </tr>
                <tr>
                    <th align="right">介绍</th>
                    <th><textarea v-model="queryinfo.NDesc"></textarea></th>
                </tr>
                <tr>
                    <th align="right"></th>
                    <th><input type="button" value="增加" class="btn btn-primary" @click="ok"></th>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">

import { ref,reactive,onMounted } from 'vue';
import moment from 'moment';
import axios from 'axios';
import { useRoute,useRouter } from 'vue-router';
const route = useRoute();
const router = useRouter();

let queryinfo:any=reactive({
  "NName": "",
  "NCode": "",
  "NDesc": "",
})

const ok=()=>{
    axios({
        url:'/api/House/AddHouseNum',
        method:'post',
        data:queryinfo
    })
    .then((res)=>{
        console.log(res);
        if(res.data>0){
            alert("添加成功");
            router.push('/houselist')
        }
        else{
            alert("添加失败");
            return
        }
    })
}



</script>

<style scoped>

</style>